package com.deanlib.cabinet.service.sync;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

import androidx.annotation.Nullable;

import com.deanlib.cabinet.data.AppDatabase;
import com.deanlib.cabinet.data.db.ResourceDao;
import com.deanlib.cabinet.data.model.Resource;

import org.greenrobot.greendao.query.WhereCondition;

import java.util.List;

/**
 * 同步服务
 * Created by Dean on 2022/8/18
 */
public class SyncService extends Service {

    private static SyncAdapter syncAdapter = null;
    private static final Object syncAdapterLock = new Object();

    @Override
    public void onCreate() {
        super.onCreate();
        if (syncAdapter == null){
            synchronized (syncAdapterLock){
                if (syncAdapter == null){
                    syncAdapter = new SyncAdapter(getApplicationContext(), true);
                }
            }
        }
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return syncAdapter.getSyncAdapterBinder();
    }

}
